// https://www.luogu.com.cn/problem/P2918

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

int weights[105];
int values[105];
int dp[60005];

int knapsack(const int n, const int w) {
    memset(dp, 0x3F3F3F3F, sizeof(dp));
    const int m = *max_element(weights+1, weights + n + 1);
    dp[0] = 0;
    const int end = w + m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= end; j++) {
            if (j < weights[i]) {
                dp[j] = min(dp[j], values[i]);
            } else {
                dp[j] = min(dp[j], dp[j-weights[i]] + values[i]);
            }
        }
    }
    // for (int i = 0; i <= w+m; i++) {
        // printf("%d->%d\n", i, dp[i]);
    // }
    return dp[w];
}

int main() {
    int n, w;
    scanf("%d %d", &n, &w);
    for (int i = 1; i <= n; i++) {
        scanf("%d %d", &weights[i], &values[i]);
    }
    printf("%d\n", knapsack(n, w));
    return 0;
}